﻿using BeeCoders.Tools.Wpf.Infrastructure;

namespace BeeCoders.Tools.Wpf.FileExplorer
{
	public class ItemViewModel : ViewModelBase
	{

		public string FullPath { get; set; }
		public string Name { get; set; }
		public object ImageName { get; set; }

		#region Property: IsSelected
		private bool isSelected;
		public bool IsSelected
		{
			get
			{
				return isSelected;
			}
			set
			{
				isSelected = value;
				RaisePropertyChanged("IsSelected");

				FileExplorerViewModel.Instance.SelectedItem = FullPath;
				
			}
		}
		#endregion

		#region Property: IsChecked
		private bool isChecked;
		public bool IsChecked
		{
			get
			{
				return isChecked;
			}
			set
			{
				isChecked = value;
				RaisePropertyChanged("IsChecked");

				if (hasCheckbox)
				{
					FileExplorerViewModel.Instance.SelectedItems.Add(FullPath);
				}
				else
				{
					FileExplorerViewModel.Instance.SelectedItems.Remove(FullPath);
				}
			}
		}
		#endregion

		#region Property: HasCheckbox
		private bool hasCheckbox;
		public bool HasCheckbox
		{
			get
			{
				if ((FileExplorerViewModel.Instance.IsMultiSelect) && hasCheckbox) return true;

				return false;
			}
			set
			{
				hasCheckbox = value;
				RaisePropertyChanged("HasCheckbox");

				
			}
		}
		#endregion

		#region Property: ShowIcons
		public bool ShowIcons
		{
			get
			{

				return FileExplorerViewModel.Instance.ShowIcons;
			}
			
		}
		#endregion

		
	}

}
